package cn.ruituo.adv3;

import java.util.Calendar;
import java.util.Date;

public class CalTest {
    //java.time
    public static void main(String[] args) {
        Calendar c=Calendar.getInstance();
        System.out.println(c);
        System.out.println(">>>>>>>>>>>>>>>>>>>>>");
        Date date=c.getTime();
        System.out.println(date);
        System.out.println("毫秒："+c.getTimeInMillis());
        System.out.println("年："+c.get(Calendar.YEAR));
        System.out.println("月："+c.get(Calendar.MONTH));
        System.out.println("天："+c.get(Calendar.DATE));
        System.out.println("一年中的第几天："+c.get(Calendar.DAY_OF_YEAR));
        System.out.println("一年中的第几周："+c.get(Calendar.WEEK_OF_YEAR));
        //c.clear();
        //修改时间的各个部分：
        c.set(Calendar.DAY_OF_MONTH,1);
        c.set(Calendar.MONTH,Calendar.OCTOBER);
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>");
        System.out.println(c);
        System.out.println(c.getTime());
        System.out.println(c.get(Calendar.DAY_OF_WEEK));
    }
}
